package uz.rt.dicom.uid;

/**
 * The class defines the properties of a unique identifier:
 * <ul>
 * <li>a unique string</li>
 * <li>name of the identifier</li>
 * <li>type of identifier that is described</li>
 * </ul>
 */
public class Uid
{
// ------------------------------ FIELDS ------------------------------

    /** Unique identifier */
    final String uid;
    /** Name of the unique identifier */
    final String name;
    /** Type of unique identifier */
    final UidType type;

// --------------------------- CONSTRUCTORS ---------------------------

    /**
     * Constructor initialises the object and sets all its parameters.
     *
     * @param uid  Unique identifier
     * @param name Name of the unique identifier
     * @param type Type of unique identifier
     */
    public Uid(final String uid, final String name, final UidType type)
    {
        this.uid = uid;
        this.name = name;
        this.type = type;
    }

// --------------------- GETTER / SETTER METHODS ---------------------

    /**
     * Get the name of the unique identifier
     *
     * @return Name of the unique identifier
     */
    public String getName()
    {
        return name;
    }

    /**
     * Get the type of unique identifier
     *
     * @return Type of unique identifier
     */
    public UidType getType()
    {
        return type;
    }

    /**
     * Get the unique identifier
     *
     * @return Unique identifier
     */
    public String getUid()
    {
        return uid;
    }

// ------------------------ CANONICAL METHODS ------------------------

    @Override
    public String toString()
    {
        return "[" + uid + "] " + name;
    }
}
